//
//  JRPlayerView.h
//  JR-Player
//
//  Created by 王潇 on 16/3/9.
//  Copyright © 2016年 王潇. All rights reserved.
//

#import "JRControlView.h"
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

#define MAGIN_W ([UIScreen mainScreen].bounds.size.width / 3)
#define CELL_H (DEVW / 16 * 9)
// 播放状态
typedef NS_ENUM(NSInteger, PlayStatus) {
    kStatusPause,//默认暂停
    kStatusPlay
};

@class JRControlView;
@interface JRPlayerView : UIView

@property (nonatomic, strong) AVPlayer			*player;
/** playerLayer */
@property (nonatomic, strong) AVPlayerLayer     *playerLayer;

@property (nonatomic, strong) AVAsset			*asset;
@property (nonatomic, strong) AVPlayerItem		*playerItem;
@property (nonatomic, strong) NSString			*urlString;
@property (nonatomic, strong) NSString			*title;

@property (nonatomic, strong) NSString			*imageUrl;
@property (nonatomic, strong) NSURL				*assetUrl;
@property (nonatomic, strong) JRControlView		*smallControlView;	// 小屏控制 View

@property (nonatomic, strong) UIImageView *viewBg;
@property (nonatomic, strong) NSString *imgv_default;

@property (nonatomic, assign) PlayStatus status;

@property (nonatomic, copy) void ((^ statusBlock)(PlayStatus status));

- (instancetype)initWithFrame:(CGRect)frame
						image:(NSString *)imageUrl
						asset:(NSURL *)assetUrl;

//- (instancetype)initImage:(NSString *)imageUrl asset:(NSURL *)assetUrl;

- (instancetype)initWithFrame:(CGRect)frame
						asset:(NSURL *)assetUrl;

- (instancetype)initWithURL:(NSURL *)assetURL;

- (void)prepareToPlay;

- (void)play;

- (void)pause;

// -- 定时器
- (void)addTimer;

- (void)removeTimer;

- (void)smallControlDisAppear;
@end
